package main

import (
	"fmt"
	"image"

	"github.com/disintegration/imaging"
	qrcode "go-qrcode"
)

func main() {
	src, err := imaging.Open("./1477288.jpeg")
	if err != nil {
		fmt.Printf("Open failed: %v", err)
	}

	if err := qrcode.WriteFile("http://baidu.com", qrcode.Medium, 120, "./qr.png"); err != nil {
		fmt.Printf("Open failed: %v", err)
	}
	qrfile, err := imaging.Open("./qr.png")
	if err != nil {
		fmt.Printf("Open failed: %v", err)
	}
	//qrfile = imaging.Resize(qrfile, 120, 120, imaging.Lanczos)
	t := imaging.Overlay(src, qrfile, image.Point{0, 0}, 1.0)

	imaging.Save(t, "1447_test.jpeg")
}
